<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
	<title>${title}</title>
	<meta name="keywords" content="${keywords}">
	<meta name="description" content="${description}">
	 <meta name="apple-mobile-web-app-title" content="${title}" />
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="icon" type="image/png" href="${Domain}common/amazeui/i/favicon.png">
    <link rel="apple-touch-icon-precomposed" href="${Domain}common/amazeui/i/app-icon72x72@2x.png">
   <link rel="stylesheet" href="${Domain}common/weui/css/weui.min.css">
    <link rel="stylesheet" href="${Domain}common/amazeui/css/amazeui.min.css" />
    <link rel="stylesheet" href="${Domain}common/amazeui/css/amazeui.datatables.min.css" />
    <link rel="stylesheet" href="${Domain}common/amazeui/css/app.css">
    <script src="${Domain}common/amazeui/js/jquery.min.js"></script>

</head>

<body data-type="login">
    <script src="${Domain}common/amazeui/js/theme.js"></script>
    <div class="am-g tpl-g">
        <!-- 风格切换 -->
        <div class="tpl-skiner">
            <div class="tpl-skiner-toggle am-icon-cog">
            </div>
            <div class="tpl-skiner-content">
                <div class="tpl-skiner-content-title"> 选择主题
                </div>
                <div class="tpl-skiner-content-bar">
                    <span class="skiner-color skiner-white" data-color="theme-white"></span>
                    <span class="skiner-color skiner-black" data-color="theme-black"></span>
                </div>
            </div>
        </div>
        <div class="tpl-login">
            <div class="tpl-login-content">
                <div class="am-alert am-alert-danger" data-am-alert>
  <button type="button" class="am-close">&times;</button>
  <p>初次登录，需要重新设置密码！</p>
</div>
               <form class="am-form tpl-form-line-form"  method="post" action="${Domain}api/user/resetpwd" id="user-update">
                               
                                    <div class="am-form-group">
                                      
                                        <div class="am-u-sm-12">
                                            <input type="password" class="tpl-form-input" id="pwd" name="pwd" placeholder="请输入原密码" required/>
                                        </div>
                                    </div>

                                    <div class="am-form-group">
                                    
                                        <div class="am-u-sm-12">
                                            <input type="password" class="tpl-form-input" id="password" name="password" minlength="6" maxlength="20"  placeholder="请输入新密码(6-20字符)" required/>
                                        </div>
                                    </div>
									<div class="am-form-group">
                                     
                                        <div class="am-u-sm-12" class="">
                                            <input type="password" class="tpl-form-input" id="rpwd" name="rpwd" minlength="6" placeholder="请再次输入新密码" required/>
                                        </div>
                                    </div>
                                    
                                	 <div class="am-form-group">
                                        <div class="am-u-sm-6 am-u-sm-push-3">
                                            <button type="submit" class="am-btn page-header-button tpl-btn-bg-color-success am-btn-block">重置密码</button>
                                        </div>
                                    </div>
                                </form>
            </div>
        </div>
    </div>
<script src="${Domain}common/amazeui/js/amazeui.min.js"></script>
<script src="${Domain}common/amazeui/js/app.js"></script>
 <script src="${Domain}common/weui/js/weui.min.js"></script>
<script type="text/javascript" src="${Domain}common/js/jquery.form.min.js"></script> 
<script type="text/javascript">
  var loading ; 
 $(function() {

  $('#user-update').validator({
    onValid: function(validity) {
   
      $(validity.field).closest('.am-form-group').find('.am-alert').hide();
    },
    onInValid: function(validity) {
   
      var $field = $(validity.field);
      var $group = $field.closest('.am-form-group');
      var $tpl = $group.find('.tpl-form-input');
      var $alert = $group.find('.am-alert');
      // 使用自定义的提示信息 或 插件内置的提示信息
      var msg = $tpl.data('validationMessage') || this.getValidationMessage(validity);

      if (!$alert.length) {
        $alert = $('<div class="am-alert am-alert-danger"></div>').hide().
          insertAfter($tpl);
          
      }

      $alert.html(msg).show();
    }
  });
});
  
  
   $('#user-update').ajaxForm({
	    beforeSubmit: function(a,f,o) {
	    	if($("#password").val()!=$("#rpwd").val())
	    	{
	    	   weui.alert("两次密码不一样，请从新输入！"); 
	    	   return false;
	    	}
	    	if($("#password").val().length==0)return false;
	        loading=weui.loading('数据加载中...');
	    },
	    success: function(json) {	    	
	    	if(json.status)
	    	{
	    	  	if(loading) loading.hide();
	    		weui.toast(json.msg);   
	    		location.href="${url}";				
	    	}else
	    	{	
	    		if(loading) loading.hide(); 
	    	    weui.alert(json.msg);  		 
	    	}
	    }
	});
	</script>
</body>

</html>